﻿namespace MhAdmin.SqlSugar;

public interface IRulesUtils
{
    /// <summary>
    /// 生成一个流水号
    /// </summary>
    /// <param name="serialCode">流水号编码</param>
    /// <returns></returns>
    /// <exception cref="RuleException"></exception>
    string Next(string serialCode);

    /// <summary>
    /// 生成一个流水号
    /// </summary>
    /// <param name="serialCode">流水号编码</param>
    /// <param name="code">唯一编码</param>
    void Next(string serialCode, out string code);

    /// <summary>
    /// 生成流水号
    /// </summary>
    /// <param name="serialCode">流水号编码</param>
    /// <param name="length">长度</param>
    /// <returns></returns>
    /// <exception cref="RuleException"></exception>
    RuleEnumerator<string> NextArray(string serialCode, int length);

    /// <summary>
    /// 生成一个流水号
    /// </summary>
    /// <param name="serialCode">流水号编码</param>
    /// <returns></returns>
    /// <exception cref="RuleException"></exception>
    Task<string> NextAsync(string serialCode);

    /// <summary>
    /// 生成流水号
    /// </summary>
    /// <param name="serialCode">流水号编码</param>
    /// <param name="length">长度</param>
    /// <returns></returns>
    /// <exception cref="RuleException"></exception>
    Task<RuleEnumerator<string>> NextArrayAsync(string serialCode, int length);
}
